package com.market.plus.core.domain;

import com.market.plus.core.exception.ExceptionCode;
import com.market.plus.core.exception.TypeCodeException;
import com.market.plus.core.exception.UnsupportTypeException;

public enum LockStatus {
   AVAIABLE(0), ISLOCKED(1), LOCKED(2), REQUESTED(3), ISREQUESTED(4);

   private int fiendStatus;

   public int getFriendStatus() {
      return fiendStatus;
   }

   private LockStatus(int fiendStatus) {
      this.fiendStatus = fiendStatus;
   }

   public static LockStatus getFriendStatus(int fiendStatus) throws UnsupportTypeException {
      LockStatus value = null;
      switch (fiendStatus) {
      case 0:
         value = AVAIABLE;
         break;
      case 1:
         value = ISLOCKED;
         break;
      case 2:
         value = LOCKED;
         break;
      case 3:
         value = REQUESTED;
         break;
      case 4:
         value = ISREQUESTED;
      default:
    	 throw new UnsupportTypeException(ExceptionCode.instance(TypeCodeException.class, TypeCodeException.FRIENDSTATUS));
      }
      return value;
   }
}
